Title Banner


Technical Q&A's


GXPD 14 - QuickDraw GX 'ptyp' Page Size Calc (1-May-95)


Q The following code is from one of the sample GX drivers for a 'ptyp' resource. How are the hex numbers derived from the inch numbers for page and paper sizes? For example, what does 8.10667 inches have to do with the number 0x0247AE18?

resource gxPaperTypeType ( gxPrintingDriverBaseID + 1, "US Letter",
kResAttributes ) {
 
   "US Letter",
 
   /* page rectangle */
   0x00000000, /* 0.0 */
   0x00000000, /* 0.0 */
   0x0247AE18, /* 8.10667 */
   0x0308A3DC, /* 10.7867 */
 
   /* paper rectangle */
   0xFFF1D70C, /* -0.196666 */
   0xFFF870A8, /* -0.104999 */
   0x0255D70C, /* 8.30333 */
   0x031070A8, /* 10.895 */
 
   usLetterBase,
   kCreatorType,
 
   inch,
   etc.


A The hex numbers represent pixels, and the values within the comments are in inches. Let's take a look at a piece of the gxPaperTypeType you sent:

   0x0247AE18, /* 8.10667 */

0x0247AE18 translates to 583.68005 pixels. When you divide 583.68005 by 72, you get 8.1066674 -- the same value as the comment.

Technical Support
Technical Q&As
Previous Question | Contents | Next Question

Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help